<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>麦知网——学问有余，可为人师</title>

<!-- Bootstrap core CSS -->
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../css/sco.message.css" rel="stylesheet">
<link href="../css/scojs.css" rel="stylesheet">
<link href="../css/non-responsive.css" rel="stylesheet">
<link href="../css/jquery.sinaEmotion.css" rel="stylesheet">
<link href="ico/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"/>

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
<link href="../css/bootstrap-switch.css" rel="stylesheet">
<link href="../css/index.css" rel="stylesheet">  

<script>
var array=new Array();
</script>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="../js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="../js/bootstrap.js"></script> 
<script src="../js/share.js"></script>
<script src="../js/publish_news.js"></script>
<script src="../js/sco.message.js"></script>
<script src="../js/good.js"></script>
<script src="../js/message.js"></script>
<script src="../js/comment.js"></script>
<script src="../js/logout.js"></script>
<script src="../js/emotion.js"></script>
<script src="../js/add.js"></script>
<script src="../js/bootstrap-switch-2.js"></script>

</head>
<body>
	<div class="loading"></div>
	{% include 'public/common/header.html' %}
	<div class="container" style="margin-top:45px;">
		<div class="row">
<!-- 左侧div -->
			<div class="col-xs-4">
<!-- 个人名片 -->
				<div class="person">
					<div>
						<div class="person_img pull-left">
							{% if info.img %}
							<img src="{{info.domain}}/{{info.img}}" width="100%"/>
							{% else %}
							<img src="{{info.domain}}/default.png" width="100%"/>
							{% endif %}
						</div>
						<div class="pull-left person_intro">
							<div class="intro">
								<span><a href="{% url 'users:home' id %}"><font size="4"><strong>{{info.user_name|capfirst}}</strong></font></a></span>{% ifequal purview '1' %}<i class="icon-check" title="认证用户" style="margin-left:7px"></i>{% endifequal %}{% ifequal purview '2' %}<i class="icon-home" title="企业用户" style="margin-left:7px"></i>{% endifequal %}
								<!--<span class="span_span"><a href="{% url 'users:setting' %}" title="设置"> <i class="icon-cogs"></i></a></span>
								<span class="pull-right"><a href="" title="管理我的课程"><i class="icon-table icon-large"></i></a></span>-->
								<span class="pull-right"><a href="{% url 'users:setting' %}" title="设置"> <i class="icon-cogs"></i></a></span>
								<div class="clearfix"></div>
							</div>
							<div class="intro" style="margin-top:10px">
								<span class="span_span2"><font size="1"><i class='icon-globe'></i> {% ifequal info.position 'None' %}未填写{% else %}{{info.position}}{% endifequal %}</font></span>
								<span><font size="1"><i class="icon-suitcase"></i> {% ifequal info.work 'None' %}未填写{% else %}{{info.work}}{% endifequal %}</font></span>
							</div>
							<div class="intro">
								<div class="pull-left"><font size="1"><i class="icon-pencil"></i></font></div>
								<div class="span_ctrl pull-left"><font size="1"><i>{% if info.sign %}{{info.sign}}{% else %}未填写{% endif %}</i></font></div>
								<div class="clearfix"></div>
							</div>
						</div>
						<div class="clearfix"></div>
					</div>
					<div class="person_2" id="newsPub">
						<div  class="topdirection"></div>
						<form>
						<div style="background-color:white;"><textarea id="news" class="news_text emotion" placeholder="发表新鲜事..."></textarea></div>
						<div class="btn_fabu">
							<span><a href="javascript:void(0)" id="face"><font size="1"><i class="icon-dashboard"></i> 表情</font></a></span> <span><a href="javascript:void(0)" onclick="add_pic();"><font id="add" size="1"><span class="glyphicon glyphicon-picture"></span> 图片</font><font id="cancel" size="1" style="display:none;"><span class="glyphicon glyphicon-picture"></span> 取消添加图片</font></a></span> <span><a href="javascript:void(0)" id="link" onclick="add_link()"><font size="1"><i class="icon-link"></i> 链接</font></a></span>
							<span class="pull-right"><button type="button" class="btn btn-primary btn-xs" onclick="push()"><strong> 发  布  </strong></button></span>
							<div class="clearfix"></div>
							<div id="news_pic" style="margin-bottom:5px;display:none;padding:5px 5px 5px 5px;">
								<input type="file" id="file" name="news_picture" multiple />
								<div id="list"></div>
							</div>
							<div id="news_link" style="margin-bottom:5px;display:none;padding:5px 5px 5px 5px;">
								<input type="text" id="links" />
								<a href="javascript:void(0)" onclick="changelink()">确定</a>
							</div>
						</div>
						</form>
					</div>
				</div>
<!-- 我的小组、课程、悬赏令 -->
				<div class="my">
					<div class="my_in">
						<span class="pull-left"><a href="{% url 'users:managegroup' %}"><b>我的小组</b></a></span>
						<!--<span class="pull-right"><a href=""><span class="label label-info">42</span></a></span>-->
						<div class="clearfix"></div>
					</div>
					<div class="my_in">
						<span class="pull-left"><a href="{% url 'users:managecourse' %}"><b>我的课程</b></a></span>
						<!--<span class="pull-right"><a href=""><span class="label label-info">42</span></a></span>-->
						<div class="clearfix"></div>
					</div>
					<div class="my_in2">
						<span class="pull-left"><a href="{% url 'users:managereward' %}"><b>我的悬赏</b></a></span>
						<!--<span class="pull-right"><a href=""><span class="label label-info">42</span></a></span>-->
						<div class="clearfix"></div>
					</div>
				</div>
<!-- 推荐用户 -->
				<div class="my">
					<div class="my_title">
						<div class="pull-left"><b>#活跃用户</b></div>
						<!--<div class="pull-right"><button type="button" class="btn btn-default btn-xs" onclick="">换一批</button></div>-->
						<div class="clearfix"></div>
					</div>
<!-- 一个活跃用户 循环开始处 -->
					{% for h in hotuser %}
					<div class="a_guy">
						<div class="pull-left person_avatar"><a href="{% url 'users:home' h.0 %}"><img src="{{h.2}}/{{h.3}}" class="img-circle" width="90%"/></a></div>
						<div class="pull-left person_content">
							<div>
								<span class="person_name"><a href="{% url 'users:home' h.0 %}"><b>{{h.1}}</b></a></span>
								<span class="focus">
									<span><font size="1"><i class="icon-suitcase"></i> {% ifequal h.5 'None' %}未填写{% else %}{{h.5}}{% endifequal %}</font></span>
								</span>
							</div>
							<div class="show_person" id="show_person{{h.0}}">
								{% ifequal h.4 2 %}
								<button type="button" class="btn btn-success btn-xs" onclick="add({{h.0}});">关注</button>
								{% endifequal %}
								{% ifequal h.4 1 %}
								<font size="1" color="#333333">已关注</font>
								{% endifequal %}
								<!--
								<div class="switchDiv">
									<div class="switch switch-mini" data-on="info" data-off="NO">	
										{% ifequal h.4 2 %}
										<input type="checkbox" checked="checked" onchange="add({{h.0}})"/> 
									
								{% endifequal %}
								{% ifequal h.4 1 %}
									
										<input type="checkbox" onchange="add({{h.0}})" />
									{% endifequal %}
									</div>
								</div>
								-->
							</div>
						</div>
						<div class="clearfix"></div>
					</div>
					{% endfor %}
<!-- 一个活跃用户 循环结束处 -->
				</div>
<!-- 推荐课程 -->
				<div class="my">
					<div class="my_title"><b>#热门课程</b></div>
<!-- 一个热门课程 循环开始处 -->
					{% for hc in hotcourse %}
					<div class="a_guy">
						<div class="pull-left person_avatar"><a href="{% url 'courses:thecourse' hc.id %}"><img src="{{hc.domain}}/{{hc.img}}" class="img-circle" width="90%"/></a></div>
						<div class="pull-left person_content">
							<div><span class="person_name"><a href="{% url 'courses:thecourse' hc.id %}"><b>{{hc.name}}</b></a></span></div>
							<div class="show_person"><i>￥{{hc.price}}</i></div>
						</div>
						<div class="clearfix"></div>
					</div>
					{% endfor %}
<!-- 一个热门课程 循环结束处 -->
				</div>
<!-- 一个广告位 -->
				<div class="ad">
					<img src="../img/ad.jpg" height="200px" width="100%">
				</div>
			</div>
<!-- 右侧div -->
			<div class="col-xs-8">
				<div class="hot_group">
					{% if groupAndTwoTopic.1 %}
					<div class="hot_group_title"><b>#话题动态</b></div>
					<div>
						<div class="pull-left hot_group_img">
							<div>
								<a href="{% url 'groups:thegroup' groupAndTwoTopic.0 %}" title="{{groupAndTwoTopic.1}}" target="_blank"><img src="{{groupAndTwoTopic.2}}/{{groupAndTwoTopic.3}}" width="100%"/></a>
							</div>
							<div class="join_group" id="join_group{{groupAndTwoTopic.0}}">
								{% ifequal groupAndTwoTopic.4 2 %}
								<button type="button" class="btn btn-success btn-xs" onclick="join({{groupAndTwoTopic.0}});">加入</button>
								{% endifequal %}
								{% ifequal groupAndTwoTopic.4 1 %}
								<font size="1" color="#333333"><b>已加入</b></font>
								{% endifequal %}
							</div>
						</div>
						<div class="pull-right hot_group_topics">
							<div style="border-bottom:1px solid #ffffff;"><a href="{% url 'groups:thegroup' groupAndTwoTopic.0 %}" title="{{groupAndTwoTopic.1}}" target="_blank"><b>{{groupAndTwoTopic.1}}</b></a></div>
							<div>
								{% if groupAndTwoTopic.5 %}
								<div class="indextopic"><a href="{% url 'groups:thetopic' groupAndTwoTopic.5 %}" target="_blank">{{groupAndTwoTopic.6}}</a></div>
								{% endif %}
								{% if groupAndTwoTopic.7 %}
								<div class="indextopic"><a href="{% url 'groups:thetopic' groupAndTwoTopic.7 %}" target="_blank">{{groupAndTwoTopic.8}}</a></div>
								{% endif %}
							</div>
						</div>
						<div class="clearfix"></div>
					</div>
					{% endif %}
				</div>
				<div class="all_news_div">
<!-- 一条新鲜事 循环开始处 -->
					<div class="newsDiv">
						<div class="in_newsDiv"> 
							<strong>#您订阅的新鲜事</strong>
						</div>
					</div>
					{% for i in result %}
					<div class="newsDiv">
						<a name="news_{{i.8}}"></a>
						<div class="in_newsDiv"> 
							<div class="news_photo pull-left">
									<a href="{% url 'users:home' i.10 %}" ><img src="{{info.domain}}/{{i.1}}-mzhead" width="100%"/></a>
							</div>

							<div class="news_content pull-left">
								<div><span><a href="{% url 'users:home' i.10 %}" id="n{{i.8}}" data-toggle="popover" title="" data-content="{{i.9}}"
                                              data-original-title="<strong>{{i.0}}</strong> <font size='1'><i class='icon-globe'></i>
                                              {% if i.11 %}{{i.11}}{% else %}未填写{% endif %}</font></span>  <span><font size='1'><i class='icon-suitcase'></i>
                                              {% if i.12 %}{{i.12}}{% else %}未填写{% endif %}</font></span>" ><b>{{i.0}}</b></a><a href="#" data-toggle="modal"
                                                                                                                                 data-target="#myModal{{i.8}}" title="向{{i.0}}发私信">
                                    <i class="icon-envelope-alt pull-right"></i></a></span><!--<span style="font-size:">{{i.9}}</span>--><span class="time">{{i.3|date:"Y-m-d H:i:s"}}</span></div>
								<script>
									array.push({{i.8}})
									var $share{{i.8}} = $('#s{{i.8}}');
								
									$share{{i.8}}.data('state', 'hover');
									$share{{i.8}}.popover({html:true})
									var enterShow = function () {
									    if ($share{{i.8}}.data('state') === 'hover') {
									        $share{{i.8}}.popover('show');
									    }
									};
									var exitHide = function () {
									    if ($share{{i.8}}.data('state') === 'hover') {
									        $share{{i.8}}.popover('hide');
									    }
									};

									var clickToggle = function () {
									    if ($share{{i.8}}.data('state') === 'hover') {
									        $share{{i.8}}.data('state', 'pinned');
									    } else {
									        $share{{i.8}}.data('state', 'hover')
									        $share{{i.8}}.popover('hover');
									    }
									};

									$share{{i.8}}.popover({trigger: 'manual'})
									    .on('mouseenter', enterShow)
									    .on('mouseleave', exitHide)
									    .on('click', clickToggle);
								</script>
								<div class="modal fade" id="myModal{{i.8}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
								  <div class="modal-dialog">
								    <div class="modal-content">
								      <div class="modal-header">
								        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								        <h4 class="modal-title">回复私信给{{i.0}}</h4>
								      </div>
								      <div class="modal-body">
								        <textarea class="form-control" id="message{{i.8}}" style="height:120px"></textarea>
								      </div>
								      <div class="modal-footer">
								      	<span id='messageresult{{i.8}}'></span>
								        <button type="button" onclick="connected({{i.8}})" class="btn btn-primary">发送</button>
								      </div>
								    </div><!-- /.modal-content -->
								  </div><!-- /.modal-dialog -->
								</div><!-- /.modal -->
								<div class="content">{% autoescape off %}{{i.2}}{% endautoescape %}</div>
								<div class="larger_pic">
									{% if i.4 %}
									<div class="control_img_width_for_js">
												<img id="larger{{i.8}}" src="{{i.4}}" />
											</div>
									{% endif %}
								</div>
								<div class="pull-right">
									<span class="span_news"><a href="javascript:void(0)" onclick="clickgood({{i.8}})"><i class="icon-thumbs-up"></i> <span id="good{{i.8}}">{{i.5}}</span></a></span>
									<span class="span_news"><a href="#" data-toggle="modal" data-target="#shareThis{{i.8}}" title="分享到我的新鲜事">
                                        <i class="icon-share-alt"></i> <span id="share{{i.8}}">{{i.6}}</span></a></span>
									<span class="span_news"><a href="javascript:void(0)" id="redirect{{i.8}}" onclick="comment({{i.8}});">
                                        <i class="icon-comment"></i> <span id="review{{i.8}}">{{i.7}}</span></a></span>
								</div>
								<div class="modal fade" id="shareThis{{i.8}}" tabindex="-1" role="dialog" aria-hidden="true">
								  <div class="modal-dialog">
								    <div class="modal-content">
								      <div class="modal-header">
								        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								        <h4 class="modal-title">分享到我的新鲜事</h4>
								      </div>
								      <div class="modal-body">
								      	写下你的分享理由?
								      	<div class="content" style="margin-bottom:20px">
                                            <textarea id="sharemsg{{i.8}}" class="form-control"></textarea></div>
								       	    <textarea style="display:none" id="c{{i.8}}">//<a id='s{{i.8}}' data-toggle='popover' data-content='{{i.9}}'
                                                                                          data-original-title="<strong>{{i.0}}</strong> <font size='1'><i class='icon-globe'></i>
                                                                                          {% if i.11 %}{{i.11}}{% else %}未填写{% endif %}</font></span>  <span><font size='1'>
                                                                                          <i class='icon-suitcase'></i> {% if i.12 %}{{i.12}}{% else %}未填写{% endif %}</font>
                                                                                          </span>" href="{% url 'users:home' i.10 %}">{{i.0}}</a>:{{i.2}}</textarea>
								       	<script>
											array.push({{i.8}});
											var $btn{{i.8}} = $('#n{{ i.8 }}');
										
											$btn{{i.8}}.data('state', 'hover');
											$btn{{i.8}}.popover({html:true});
											var enterShow = function () {
											    if ($btn{{i.8}}.data('state') === 'hover') {
											        $btn{{i.8}}.popover('show');
											    }
											};
											var exitHide = function () {
											    if ($btn{{i.8}}.data('state') === 'hover') {
											        $btn{{i.8}}.popover('hide');
											    }
											};

											var clickToggle = function () {
											    if ($btn{{i.8}}.data('state') === 'hover') {
											        $btn{{i.8}}.data('state', 'pinned');
											    } else {
											        $btn{{i.8}}.data('state', 'hover')
											        $btn{{i.8}}.popover('hover');
											    }
											};

											$btn{{i.8}}.popover({trigger: 'manual'})
											    .on('mouseenter', enterShow)
											    .on('mouseleave', exitHide)
											    .on('click', clickToggle);
										</script>
								       		 {% if i.4 %}
								       		<div class="control_img_width_for_js">
												<img src="{{i.4}}" />
											</div>
											 {% endif %}
								      </div>

                                      <div class="modal-footer">
								        <button type="button" onclick="shareTo({{i.8}})" class="btn btn-primary">分享</button>
								      </div>

								    </div><!-- /.modal-content -->
								  </div><!-- /.modal-dialog -->
								</div><!-- /.modal -->
								<div class="clearfix"></div>
							</div>
							<div class="clearfix"></div>
<!--在这个div里加入评论-->
							<div>
<!--评论 点击出现-->
								<div id="comment{{i.8}}" class="comment" style="display:none;">
									<div class="comment_act">
										<div class="comment_act1 pull-left">
											<textarea class="comment_act1_tarea" id="comment_tarea{{i.8}}"></textarea>
										</div>
										<div id="coAndcocomment{{i.8}}" class="comment_act2 pull-left">
											<button type="button" class="btn btn-info comment_act_btn" onclick="comment_t({{i.8}});">评论</button>
										</div>
										<div class="clearfix"></div>
									</div>
<!-- 某条新鲜事的评论 循环开始处 -->
									<div class="a_comment">
										<div id="first_commend{{i.8}}">
											{% if i.16 %}
											<div class="comment_a_style">
												<div class="pull-left comment_img">
													<a href="{% url 'users:home' i.21 %}"><img src="{{i.22}}/{{i.16}}" class="img-circle" width="100%"></a>
												</div>
												<div class="pull-left comment_content">
													<div>
														<div class="pull-left">
															<a href="{% url 'users:home' i.21 %}"><b>{{i.15}}</b></a>
														</div>
														<div class="pull-right comment_time">
															{{i.19|date:"Y-m-d H:i:s"}}
														</div>
														<div class="clearfix"></div>
													</div>
													<div class="comment_concontent">
														{{i.14}}
													</div>
													<div class="pull-right">
														<span class="span_news"><a href="javascript:void(0)" onclick="cogood({{i.13}})"><i class="icon-thumbs-up">

														</i> <span id="cogood{{i.13}}">{{i.18}}</span></a></span>
														<span class="span_news"><a href="javascript:void(0)" onclick="cocomment({{i.13}},'{{i.15}}',{{i.17}},{{i.8}});">
                                                            <i class="icon-comment"></i> <span id="cocomment_span{{i.13}}"></span>{{ i.20 }}</a></span>
													</div>
												</div>
												<div class="clearfix"></div>
											</div>
											{% endif %}
										</div>
<!-- 回复的回复 加入的div 
										<div>
											<div id="cocomment{{i.13}}" class="cocomment_act" style="display:none;">
												<div class="comment_act1 pull-left">
													<textarea id="cocomment_act1_tarea{{i.8}}" class="comment_act1_tarea"></textarea>
												</div>
												<div class="comment_act2 pull-left">
													<button type="button" class="btn btn-info comment_act_btn">评论</button>
												</div>
												<div class="clearfix"></div>
											</div>
										</div>-->
										
										<div style="margin-top:5px;" id="see_more_re{{i.8}}"> 
											{% if i.16 %}
											<a href="javascript:void(0)" onclick="get_more_re({{i.8}});">查看更多评论</a>
											{% endif %}
										</div>
										
									</div>
									
<!-- 某条新鲜事的评论 循环结束处 -->
								</div>
							</div>
						</div>
					</div>
					{% endfor %}

					
					<ul class="pager">
					{% if topics.has_previous %}
					  <li><a href="?page={{ topics.previous_page_number }}">&larr;上一页</a></li>
					{% endif %}
					共 {{ topics.paginator.num_pages }} 页  第 {{ topics.number }} 页.
					{% if topics.has_next %}
					  <li><a href="?page={{ topics.next_page_number }}">下一页&rarr;</a></li>
					{% endif %}
					</ul>
<!-- 一条新鲜事 循环结束处 -->

				</div>
			</div>
		</div>
	</div>

	

	<script type="text/javascript">
	window.onload=function(){
		$(".control_img_width_for_js img").css("width","330px");
		/*var worker=new Worker('../js/image.js');
		for(i in array){
			i=parseInt(i)+1;
			worker.postMessage(i);
			worker.onmeessage=function(event){
				document.getElementById('larger'+i).style.display='inline'
				document.getElementById('wait'+i).style.display='none'
				document.getElementById('larger'+i).src=event.data
			}
		}*/
		/*for(i in array){
			max=i
		}
		min=array[0];
		u="/users/getimg/?start="+min+"&end="+max;
		worker=new Worker(u)
		worker.onmeessage=function(event){
			alert(event.data);
		}*/
		/*for(i in array){
			i=parseInt(i)+1;
			var ul="/users/getimg/?imgid="+i
			var worker=new Worker(ul)
			worker.onmeessage=function(event){
				document.getElementById('larger'+i).style.display='inline'
				document.getElementById('wait'+i).style.display='none'
				document.getElementById('larger'+i).src=String(event.data)
			}
		}*/
		/*function get(){
			createXMLRequest();
			i=parseInt(i)+1;
			var url="/users/getimg/?imgid="+i;
			xmlHttp.open("GET",url);
			xmlHttp.onreadystatechange=function(){
				if(xmlHttp.readyState==4 && xmlHttp.status==200){
					document.getElementById('larger'+i).style.display='inline'
					document.getElementById('wait'+i).style.display='none'
					document.getElementById('larger'+i).src=xmlHttp.responseText
				}
			};
			xmlHttp.send();
		}*/
		$(".loading").fadeOut(1000); 
		array=window.location.href.split('#');
		if(array[1]){
			var news_id=array[1].split('_');
			$("#comment"+news_id[1]).show("slow");
			get_more_re(news_id[1]);
		}
		cache_emotion2();
		$('#face').SinaEmotion($('.emotion'));
		//alert(document.getElementById('123').innerHTML)
		/*for(i in array){
			createXMLRequest();
			i=parseInt(i)+1;
			var url="/users/getimg/?imgid="+i;
			xmlHttp.open("GET",url);
			xmlHttp.onreadystatechange=function(){
				if(xmlHttp.readyState==4 && xmlHttp.status==200){
					document.getElementById('larger'+i).style.display='inline'
					document.getElementById('wait'+i).style.display='none'
					document.getElementById('larger'+i).src=xmlHttp.responseText
				}
			};
			xmlHttp.send();
		}*/
	}
		var add_time=null;
		function add_pic(){
			if(add_time!=null){
				clearTimeout(add_time);
			}
			add_time=setTimeout(function(){
				$("#news_pic").toggle('slow');
		 		$("#cancel").toggle();
				$("#add").toggle();
			},200);

		}
		function add_link(){
			if(add_time!=null){
				clearTimeout(add_time);
			}
			add_time=setTimeout(function(){
				$("#news_link").toggle('slow');
			},200);
		}
		//将超链接转换成超链接格式
		function changelink () {
			var link=document.getElementById('links').value;
			link="<a href="+link+" target='_blank'>"+link+"</a>";
			document.getElementById("news").value+=link;
			document.getElementById('news_link').style.display="none";
		}
		//JS FileReader
		var imgs;
	function handleFileSelect(evt) {
		var files = evt.target.files; // FileList object

		// Loop through the FileList and render image files as thumbnails.
		//for (var i = 0, f; f = files[i]; i++) {

		  // Only process image files.
		  if (!files[0].type.match('image.*')) {
		    return false;
		  }

		  var reader = new FileReader();

		  // Closure to capture the file information.
		  reader.onload = (function(theFile) {
		    return function(e) {
		      // Render thumbnail.
		      var span = document.createElement('span');

		      span.innerHTML = ['<img name="img1" class="img-thumbnail" src="', e.target.result,
		                        '" title="', escape(theFile.name), '"/>'].join('');
		    	document.getElementById('list').innerHTML = "";
		      	document.getElementById('list').insertBefore(span, null);
		      
		      imgs=escape(e.target.result);
		      //var urls=document.images.item(img1).src;
		    };
		  })(files[0]);
		  // Read in the image file as a data URL.
		  reader.readAsDataURL(files[0]);
		}
		//}
		document.getElementById('file').addEventListener('change', handleFileSelect, false);


		function larger(a)
		{
			var wid=$("#larger"+a).css("width");
			if(wid=="380px")
			{
				$("#larger"+a).css("width","100px");
			}
			else
			{
				$("#larger"+a).css("width","380px");
			}

		}

		function change()
		{
			$(".larger").css("cursor","pointer");
		}




		var xmlHttp; 
		function createXMLRequest(){
			if(window.ActiveXObject){
				xmlHttp=new ActiveXObject("Microsoft.XMLHttp");
			} else if(window.XMLHttpRequest){
				xmlHttp=new XMLHttpRequest();
			}
		}
		//加入小组
		function join(id)
		{
			createXMLRequest();                       
			var url="/groups/join/?id="+id;
			xmlHttp.open("GET",url);
			xmlHttp.onreadystatechange=function(){
				if(xmlHttp.readyState==4 && xmlHttp.status==200){
					if(xmlHttp.responseText==1){
						$("#join_group"+id).html("已加入");
						//alert($("#join"+id).attr("class"))
					}
					
				}
			};
			xmlHttp.send(); 
		}

//添加关注
function add(u_id){   
	createXMLRequest();                       
	var url="/users/add/?id="+u_id;
	xmlHttp.open("GET",url);
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 && xmlHttp.status==200){
			$("#show_person"+u_id).html('<font size="1" color="#333333">已关注</font>');
		}
	};
	xmlHttp.send(); 
}

//分享
function shareTo2(id){
	var i=document.getElementById('larger'+id);
	if (i){
		imgurl=document.getElementById('larger'+id).src;
	} else {
		imgurl="";
	}
	img=imgurl.split('-');
	var sharemsg=document.getElementById("sharemsg"+id).value;
	var beforeShare=document.getElementById("c"+id).value;
	var sharemsgeurl="/users/share/?sharemsg="+sharemsg+"&img="+img[0]+"&id="+id+"&before="+beforeShare;

}   //post
    $.post(
            '/users/share/',
            {
                sharemsg: sharemsg,
                img: img[0],
                id: id,
                before: beforeShare
            },

            function(){


            }

    )


	</script>
</body>
</html>

